package net.m510.autosurfer.mhbk;

import net.m510.autosurfer.common.exception.CannotLoginException;
import net.m510.autosurfer.common.exception.UnknownClientException;
import net.m510.autosurfer.core.DocumentChecker;

import org.jsoup.nodes.Document;


public class MhbkLoginPasswordChecker implements DocumentChecker {
	private String ERR_UNCORRECT_INPUT = "EMF";
	@Override
	public void check(Document doc) throws CannotLoginException,UnknownClientException {
		if ( doc.body().html().contains(ERR_UNCORRECT_INPUT)) {
			CannotLoginException cle = new CannotLoginException(
					doc.body().getElementsContainingOwnText(ERR_UNCORRECT_INPUT).first().text()
					);
			cle.setDocument(doc);
			throw cle;
		}
		return;
	}
}
